
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>修改信息</title>
    <link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" sizes="32x32" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/xadmin.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/pg_btn.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.3.2.min.js"></script>
    <script src="${pageContext.request.contextPath}/lib/layui/layui.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
</head>

<body>

<div class="x-body">
    <form class="layui-form" action="${pageContext.request.contextPath}/updateStudent.action" method="post"  id="f_auto" accept-charset="UTF-8">
        <input type="hidden" value="${sessionScope.s.sId}" name="sId" id="sId"/>
        <div class="layui-form-item">
            <label for="sStudentid" class="layui-form-label">
                <span class="f_sp">学号</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sStudentid" name="sStudentid"
                       autocomplete="off" value="${sessionScope.s.sStudentid}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sName" class="layui-form-label">
                <span class="f_sp">姓名</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sName" name="sName"
                       autocomplete="off" value="${sessionScope.s.sName}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sSex" class="layui-form-label">
                <span class="f_sp">性别</span>
            </label>
            <div class="layui-input-inline" id="sSex">
                <input type="radio" name="sSex" id="s_male" value="男" title="男" checked="">
                <input type="radio" name="sSex" id="s_female" value="女" title="女">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sAge" class="layui-form-label">
                <span class="f_sp">年龄</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sAge" name="sAge"
                       autocomplete="off" value="${sessionScope.s.sAge}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sPhone" class="layui-form-label">
                <span class="f_sp">电话</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sPhone" name="sPhone"
                       autocomplete="off" value="${sessionScope.s.sPhone}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sClassid" class="layui-form-label">
                <span class="">*</span>班级编号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sClassid" name="sClassid"
                       autocomplete="off" value="${sessionScope.s.sClassid}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sClassname" class="layui-form-label">
                <span class="">*</span>班级名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sClassname" name="sClassname"
                       autocomplete="off" value="${sessionScope.s.sClassname}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sDormitoryid" class="layui-form-label">
                <span class="">*</span>寝室编号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="sDormitoryid" name="sDormitoryid"
                       autocomplete="off" value="${sessionScope.s.sDormitoryid}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" id="btn_xg">
            <button  class="layui-btn"  id="btn_on" lay-filter="updateForm" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>

<script>
    layui.use(['form','layer','laydate'], function(){
        var form = layui.form,
            $ = layui.jquery,
            laydate = layui.laydate;
        form.on('submit(updateForm)', function(obj,sId) {

            $.ajax({
                url: '/updateStudent.action',
                type: "post",
                data:{"sId":sId},
                success:function(){
                    layer.msg('修改失败', {icon: 0, time: 3000});
                    setTimeout(function () {window.location.href='/findStudent.action';},2000);

                },
                error:function(){
                    console.log($("#sId").val());
                    layer.msg('修改成功',{icon:1,time:3000});
                    setTimeout(function () {window.location.href='/findStudent.action';},2000);
                }
            });
        })

    });

</script>
</body>
</html>
